package com.nbsaas.boot.tenant.rest.convert;

import com.nbsaas.boot.tenant.data.entity.Tenant;
import com.nbsaas.boot.tenant.api.domain.simple.TenantSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 租户-列表对象转换器
*/

public class TenantSimpleConvert implements Converter<TenantSimple, Tenant> {




@Override
public TenantSimple convert(Tenant source) {
    TenantSimple result = new TenantSimple();

                result.setNote(source.getNote());

               try {
                   if(source.getCreator()!=null){
                       result.setCreator(source.getCreator().getId());
                   }
                } catch (Exception ignored) { }


                try {
                    if(source.getCreator()!=null){
                        result.setCreatorName(source.getCreator().getName());
                    }
                } catch (Exception ignored) { }

                result.setAddDate(source.getAddDate());
                result.setBeginDate(source.getBeginDate());
                result.setPhone(source.getPhone());
                result.setDomain(source.getDomain());
                result.setName(source.getName());
                result.setLogo(source.getLogo());
                result.setExpireDate(source.getExpireDate());
                if(source.getStoreState()!=null){
                    result.setStoreStateName(String.valueOf(source.getStoreState()));
                }
                result.setStoreState(source.getStoreState());
                result.setId(source.getId());
                result.setLastDate(source.getLastDate());


    return result;
}

}